package com.hr.runnerbuddy;

import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

public class Parcourkeuze  extends Activity{
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
        setContentView(R.layout.parcourkeuze);
	}
	
	@Override
	protected void onResume() {
		super.onResume();
    	//this button will show the dialog
        ImageButton button1main = (ImageButton) findViewById(R.id.imageButton1);

        button1main.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
                //set up dialog
                final Dialog dialog = new Dialog(Parcourkeuze.this, android.R.style.Theme_Translucent_NoTitleBar);
                dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                dialog.setContentView(R.layout.parcourkeuzedialog);
                
                dialog.setCancelable(true);
                //there are a lot of settings, for dialog, check them all out!
                TextView tvLokatie = (TextView) dialog.findViewById(R.id.tViewLokatie);
                tvLokatie.setText("Rotterdam");
                TextView tvLengte = (TextView) dialog.findViewById(R.id.tViewLengte);
                tvLengte.setText("5678 m");
                //set up button
                Button button1 = (Button) dialog.findViewById(R.id.parcourkeuzedialogjaknop);
                Button button2 = (Button) dialog.findViewById(R.id.parcourkeuzedialogneeknop);
                button1.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                	dialog.cancel();
                	Intent intent = new Intent(Parcourkeuze.this,Parcouropties.class);
                	intent.putExtra("parcournaam", "mijnroute 1");
                	intent.putExtra("parcourlengte", "5678");
            		startActivity(intent);
                }
                });
                button2.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                		dialog.cancel();
                    }
                });
                //now that the dialog is set up, it's time to show it    
                dialog.show();
            }
        });
	}

}